package com.mb.app.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.mb.app.domain.TbMemberFeedback;
import com.mb.app.dao.TbMemberFeedbackMapper;
import com.mb.app.service.ITbMemberFeedbackService;
import com.mb.common.config.CommonConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 反馈意见  服务实现类
 * </p>
 *
 * @author liliping
 * @since 2019-05-21
 */
@Service
public class TbMemberFeedbackServiceImpl extends ServiceImpl<TbMemberFeedbackMapper, TbMemberFeedback> implements ITbMemberFeedbackService {
    @Autowired
    private CommonConfig commonConfig;
    @Override
    public List<TbMemberFeedback> queryList(Map<String, Object> map) {
        return this.baseMapper.lst(map);
    }

    @Override
    public int count(Map<String, Object> map) {
        return this.baseMapper.count(map);
    }

    @Override
    public TbMemberFeedback selectFeedback(Long id) {
        TbMemberFeedback memberFeedback = this.baseMapper.selectOneDtl(id);
        String imgs = memberFeedback.getFeedbackImg();
        String[] imgArray = imgs.split(";");
        for (int j = 0; j <imgArray.length ; j++) {
            imgArray[j] = commonConfig.getImgDomain() + imgArray[j];
        }
        memberFeedback.setImgArray(imgArray);
        return memberFeedback;
    }
}
